// 用户管理路由

const express = require('express')
    // const routerMenu = express.Router()
const routerUsers = express.Router()
    // 1
const expressJoi = require('@escook/express-joi')
    // 引入左侧菜单栏的处理函数
const handle = require('../router_handler/users')

const reg_schema = require('../schema/schema')
    //获取用户
routerUsers.get('/users', handle.getUsers)
    // // 查询id用户信息
routerUsers.get('/users/:id', handle.search)

// 删除用户
routerUsers.delete('/users/:id', handle.delete)

// 更新用户数据
routerUsers.put('/users/:id', handle.submit)

// 添加用户
routerUsers.post('/users', expressJoi(reg_schema.user_create_schema), handle.addUsers)

// 修改用户
routerUsers.put('/users/:uId/state/:type', handle.changeState)

// 分配用户角色
routerUsers.put('/users/:id/role', handle.updateRole)

// routerMenu.post('/users', handle.addUsers)
module.exports = routerUsers